﻿/**
* @author alex
*/

Namespace("sketch.framework");

(function () {
    var fwk = sketch.framework, dec = sketch.decorators;
    var PagesCount = 0;
    fwk.Page = klass(null, {
        _constructor:function(/*HtmlElement*/parent){
            this.view = new fwk.View(parent);
            this.name = "Page " + ++PagesCount;
        },
        add:function(/*UIElement*/element){
            this.view.layer2.add(element);
            element.addDecorator(new dec.DebugDecorator());
        },
        remove:function(/*UIElement*/element){
            this.view.layer2.remove(element);
        },
        clear: function(){
            this.view.clear();
        },
        generateModel: function(){
            return JSON.stringify(this.view.generateModel(), null, " ");
        },
        clickAt: function(x, y){
            this.view.clickAt(x, y);
        }
    });
})();